import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { HashRouter, Switch } from 'react-router-dom';
import { renderRoutes } from 'react-router-config';
// import * as serviceWorker from '../serviceWorker';
import './index.css';
import routes from './routes';
import configureStore from './redux/configureStore';

const store = configureStore(); 
let App = () => (
  <HashRouter>
    <Switch>
      <Provider store={store}>
        {renderRoutes(routes)}
      </Provider>    
    </Switch>
  </HashRouter>
);


if(process.env.NODE_ENV === 'development'){
  const { hot } = require('react-hot-loader');
  App = hot(module)(App);
}

ReactDOM.render(<App />, document.getElementById('root'));
